package practice.w917;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class NewForDemo {
    public static void main(String[] args) {
        String[] arr = {"one", "two", "three", "four", "five"};
        for (String s : arr) {
            System.out.println(s);
        }

        Collection<String> c = new ArrayList<>();
        c.add("java");
        c.add("c++");
        c.add("php");
        for (String s : c) {
            System.out.println(s);
        }
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }
        for (int i = 0; i < c.size(); i++) {
            System.out.println(c.toArray()[i]);
        }
        Iterator<String> it = c.iterator();
        while (it.hasNext()) {
            String s = it.next();
            System.out.println(s);
        }


//        String[] arr = {"one", "two", "three", "four", "five"};
//        for (String s : arr) {
//            System.out.println(s);
//        }
//
//        Collection<String> c = new ArrayList<>();
//        c.add("java");
//        c.add("c++");
//        c.add("php");
//        for (String s : c) {
//            System.out.println(s);
//        }
//        for (int i = 0; i < arr.length; i++) {
//            System.out.println(arr[i]);
//        }
//        for (int i = 0; i < c.size(); i++) {
//            System.out.println(c.toArray()[i]);
//        }
//        Iterator<String> it = c.iterator();
//        while (it.hasNext()) {
//            String s = it.next();
//            System.out.println(s);

    }
}
